<template>
  <div>
    provide原始数据：{{nameFromParent}}
    <br>
    provide更新后的数据：{{receiveParent}}
  </div>
</template>
<script>
export default {
  inject: ['nameFromParent', 'getParentName'],
  computed: {
    receiveParent() {
      return this.getParentName()
    },
  },
  watch: {
    receiveParent: function (val) {
      console.log('来自Parent组件的name值发生了变化', val)
    },
  },
  created() {
    console.log(this.nameFromParent)
  },
}
</script>
<style lang="scss" scoped>
</style>